﻿using Pay.DTO;
using Pay.IService;
using Pay.TO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Pay.Web.Areas.Admin.Controllers
{
    /// <summary>
    /// 购买审核
    /// </summary>
    [RouteArea("admin")]
    [RoutePrefix("quotarecord")]
    public class QuotaRecordController : AdminController {
        private IQuotaRecordService _iQuotaRecordService;

        public QuotaRecordController(IQuotaRecordService iQuotaRecordService) {
            _iQuotaRecordService = iQuotaRecordService;
        }
        [HttpGet]
        public JsonResult Gets(QuotaQuery query) {
            var result = _iQuotaRecordService.Gets(query);
            return Json(ResultToJson.Json(result), JsonRequestBehavior.AllowGet);
        }

        [HttpGet]
        public JsonResult Get(long id) {
            var result = _iQuotaRecordService.Get(id);
            return Json(ResultToJson.Json(result), JsonRequestBehavior.AllowGet);
        }
        [HttpPost]
        public JsonResult Save(quota_record_dto model) {
            var result = _iQuotaRecordService.Save(model);
            return Json(ResultToJson.Json(result ? "保存成功" : "保存失败", result), JsonRequestBehavior.AllowGet);
        }
        [HttpPost]
        public JsonResult Audit(quota_audit_model model) {
            var result = _iQuotaRecordService.Audit(model);
            return Json(ResultToJson.Json(result ? "保存成功" : "保存失败", result), JsonRequestBehavior.AllowGet);
        }
    }
}